package com.miaoshaproject.error;

import com.miaoshaproject.service.UserService;
import org.springframework.stereotype.Repository;


public enum EmBussinessError implements CommonError {
    // 通用参数类型00001
    PARAMETER_VALIDATION_ERROR(20001,"参数不合法"),
    UNKNOWN_ERROR(10002,"未知错误"),
    // 10000开头为用户信息相关错误定义
    USER_NOT_EXIST(20001,"用户不存在"),
    USER_LOGIN_FAIL(20002,"手机号或用户密码不正确"),
    // 30000开头为交易信息错误定义
    STOCK_NOT_ENOUGH(30001,"库存不足"),
    USER_NOT_LOGIN(20003,"用户还没登陆"),

    ;
    private int errCode;
    private String errMsg;

    private EmBussinessError(int errCode, String errMsg) {
        this.errCode = errCode;
        this.errMsg = errMsg;
    }

    @Override
    public String toString() {
        return super.toString();
    }

    @Override
    public int getErrCode() {
        return this.errCode;
    }

    @Override
    public String getErrMsg() {
        return this.errMsg;
    }

    @Override
    public CommonError setErrorMsg(String errMsg) {
        this.errMsg = errMsg;
        return this;
    }
}
